<?php

namespace App\Http\Controllers\Admin\Award;

use Illuminate\Http\Request;
use App\Http\Controllers\Admin\BaseController;
use App\Services\Admin\AwardService;
use DB;


/**
 * 荣誉成果（教学成果管理）
 * Class Award
 * @package App\Http\Controllers\Admin\Award
 */
class AwardController extends BaseController
{
    protected $service;

    public function __construct(AwardService $service)
    {
    	parent::__construct();
        $this->service = $service;
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('themes.admin.award.index');
    }

    public function awardData() {
        $awardsdata = $this->service->ajaxData();
        return $awardsdata;
    }

    // 获奖成果类别界面渲染
    public function AwardcategoryIndex() {
        return view('themes.admin.award.category');
    }

    // 获奖成果类别数据接口
    public function categoryData() {
        $categoryData = $this->service->categoryData();
        return $categoryData;
    }
    

     /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $result = $this->service->show($id);
        return view(getThemeView('award.show'))->with($result);
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        $result = $this->service->edit($id);
        return view('themes.admin.award.edit')->with($result);
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $this->service->destroy($id);
        return redirect()->route('award.index');
    }
}